﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hi_Baidu.Plugin;
using System.Windows;
using Video;
using System.IO;
using System.Windows.Controls;

namespace Hi_Baidu.Plugin
{
    /// <summary>
    ///     提供了基础的视频相关操作
    /// </summary>
    public class Video : NetworkWindowPlugin
    {
        /// <summary>
        ///     当前是否占用视频的标志位
        /// </summary>
        private bool IS_VIDEO = false;
        /// <summary>
        ///     提供了基础的视频相关操作
        /// </summary>
        public Video()
        {
            this.name= "视频插件";
            this.description = "提供了基础的视频相关操作";
            this.author = "剑走偏锋";
            this.version = "1.0.0.0";
            this.pluginImageSize = new Size(32, 32);
            this.pluginImagePath = Directory.GetCurrentDirectory() + "../../Plugins/com.Hi_Baidu.Video/Image/Audio.png";
            TextBlock tb_Tooltip = new TextBlock();
            tb_Tooltip.Text = "开始视频会话";
            tb_Tooltip.FontFamily = new System.Windows.Media.FontFamily("微软雅黑");
            this.visiable = VISIABLE.Visiable;
            this.toolTip = tb_Tooltip;
        }

        public override Hi_Baidu.Packet.Protocol.NetworkProtocol GetNetworkProtocol()
        {
            return Hi_Baidu.Packet.Protocol.NetworkProtocol.VIDEO;
        }

        /// <summary>
        ///     得到视频包处理器
        /// </summary>
        /// <returns>返回视频包处理器</returns>
        public override Hi_Baidu.Packet.IPacketListener GetPacketListener()
        {
            return new VideoPacketListener();
        }

        /// <summary>
        ///     得到视频协议解析器
        /// </summary>
        /// <returns>返回视频协议解析器</returns>
        public override Hi_Baidu.Packet.IParser GetParser()
        {
            return new VideoProtocolParser();
        }

        public override void AppendEvent()
        {
            if(this.Control != null)
            {
                (this.Control as Image).MouseDown += new System.Windows.Input.MouseButtonEventHandler(Video_MouseDown);
            }
        }

        void Video_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            MessageBox.Show("点击我了? " + this.name);
        }

        public override void Dispose()
        {
            throw new NotImplementedException();
        }

        public override Plugin.PLUGIN_HOST GetPluginHost()
        {
            return PLUGIN_HOST.TALK_WINDOW;
        }

        public override void Initialize()
        {
            
        }

        public override PLUGIN_KEY GetPluginKey()
        {
            return PLUGIN_KEY.PLUGIN_VIDEO;
        }
    }
}
